(() => {
    let cssPath = chrome.extension.getURL('css/inject.css'); 
    let jsPath = chrome.extension.getURL('js/inject.js');
    let script = document.createElement( 'script' );

    script.setAttribute( 'src', jsPath );

    script.onload = () => {
        document.head.removeChild( script );
    };

    document.head.appendChild( script );

    let style = document.head.querySelector('#iCopy-style');
    if( !style ){
        style = document.createElement( 'link' );
        style.setAttribute( 'id', '#iCopy-style' );
        style.setAttribute( 'rel', 'stylesheet' );
        style.setAttribute( 'type', 'text/css' );
        style.setAttribute( 'href', cssPath );
        document.head.appendChild( style );
    };
})();